DECLARE SUB SetData (sData AS STRING) DECLARE FUNCTION GetData$ () DECLARE SUB SetBootDriveLetter (DriveLetter AS INTEGER) DECLARE FUNCTION GetCaller$ () DECLARE SUB SetCaller (program AS STRING) DECLARE FUNCTION GetBootDriveLetter () DECLARE FUNCTION GetVersionMajor! () DECLARE FUNCTION GetVersionMinor! () DECLARE FUNCTION GetVersionRevision! () DECLARE FUNCTION GetVersionCPU! () DECLARE SUB SetVersion (Major AS INTEGER, Minor AS INTEGER, Revision AS INTEGER, CPU AS INTEGER) 'The Following Routines Are For pc/OS 6 Program Execution '(C) 2004 Peter Chapman ' 'You Need These to Write Programs For pc/OS 6 'I Give Permission For You To Learn From These Functions And To Use However 'You Wish, BUT If You Are Programming For pc/OS 6, They Must Remain Unchanged. ' 'pc/OS 6 Memory Map ' '1584:6400 Drive Letter '1584:6401 VersionMajor '1584:6402 VersionMinor '1584:6403 VersionRevision '1584:6404 VersionCPU '1584:6405 Caller '1584:.... ... '1584:???? CHR$(255) '1584:???1 Data For Program '1584:.... ... '1584:???? CHR$(255) ' 'pc/OS Program Execution Sample ' 'SetCaller("C:\myprog.exe") 'chain "yourprog.exe" ' ' 'pc/OS Program Exit Sample ' 'chain GetCaller 'Set To Version 6.0.0.86 SetVersion 6, 0, 0, 86 'Set Caller Program SetCaller "C:\pcos6.exe" 'Set Data SetData "This Is A Command Line Arguement." 'Set Boot Drive Letter To A:\ SetBootDriveLetter (ASC("A")) CLS PRINT "pc/OS 6 Memory Code Sample" PRINT "(C) 2004 Peter Chapman" PRINT 'Show Formatted Version PRINT "pc/OS Version " + LTRIM$(STR$(GetVersionMajor)) + "." + LTRIM$(STR$(GetVersionMinor)) + "." + LTRIM$(STR$(GetVersionRevision)) + "." + LTRIM$(STR$(GetVersionCPU)) 'Get Caller Program PRINT "Caller Program: " + GetCaller 'Get Data PRINT "Data: " + GetData$ 'Get Boot Drive Letter PRINT "Boot Drive Letter: " + CHR$(GetBootDriveLetter) END FUNCTION GetBootDriveLetter DEF SEG = &H1584 GetBootDriveLetter = PEEK(&H6400) END FUNCTION FUNCTION GetCaller$ DIM Char AS INTEGER DIM prog AS STRING DEF SEG = &H1584 C = &H6405 DO Char = PEEK(C) prog = prog + CHR$(Char) C = C + 1 LOOP UNTIL Char = 255 GetCaller$ = LEFT$(prog, LEN(prog) - 1) END FUNCTION FUNCTION GetData$ DIM Char AS INTEGER DIM prog AS STRING DIM sData AS STRING DEF SEG = &H1584 C = &H6405 'Find Caller DO Char = PEEK(C) prog = prog + CHR$(Char) C = C + 1 LOOP UNTIL Char = 255 'Find Data DO Char = PEEK(C) sData = sData + CHR$(Char) C = C + 1 LOOP UNTIL Char = 255 GetData$ = LEFT$(sData, LEN(sData) - 1) END FUNCTION FUNCTION GetVersionCPU DEF SEG = &H1584 GetVersionCPU = PEEK(&H6404) END FUNCTION FUNCTION GetVersionMajor DEF SEG = &H1584 GetVersionMajor = PEEK(&H6401) END FUNCTION FUNCTION GetVersionMinor DEF SEG = &H1584 GetVersionMinor = PEEK(&H6402) END FUNCTION FUNCTION GetVersionRevision DEF SEG = &H1584 GetVersionRevision = PEEK(&H6403) END FUNCTION SUB SetBootDriveLetter (DriveLetter AS INTEGER) DEF SEG = &H1584 POKE &H6400, DriveLetter END SUB SUB SetCaller (program AS STRING) DEF SEG = &H1584 C = &H6405 D = LEN(program) FOR I = 0 TO D IF I = D THEN POKE C, 255 ELSE POKE C, ASC(LEFT$(program, 1)) program = RIGHT$(program, LEN(program) - 1) END IF C = C + 1 NEXT I END SUB SUB SetData (sData AS STRING) DIM Char AS INTEGER DIM prog AS STRING DEF SEG = &H1584 C = &H6405 'Find Caller DO Char = PEEK(C) prog = prog + CHR$(Char) C = C + 1 LOOP UNTIL Char = 255 'Set Data D = LEN(sData) FOR I = 0 TO D IF I = D THEN POKE C, 255 ELSE POKE C, ASC(LEFT$(sData, 1)) sData = RIGHT$(sData, LEN(sData) - 1) END IF C = C + 1 NEXT I END SUB SUB SetVersion (Major AS INTEGER, Minor AS INTEGER, Revision AS INTEGER, CPU AS INTEGER) DEF SEG = &H1584 POKE &H6401, Major POKE &H6402, Minor POKE &H6403, Revision POKE &H6404, CPU END SUB